class Admin::UsersController < Admin::BaseController
  def index
    if params[:order] == "point"
      @users = User.paginate :page=>params[:page],:order=>'point'
    else
      @users = User.paginate :page=>params[:page],:order=>'created_at desc'
    end
  end
  
  def destroy
    @user = User.find params[:id]
    @user.destroy
    flash[:notice] = "success deleted."
  end

  def show
    @user = User.find params[:id]
  end

  def edit
    @user = User.find params[:id]
  end

  def update
    @user = User.find params[:id]
    if @user.update_attributes params[:user]
      flash[:notice] = "success updated."
      redirect_to admin_users_path
    else
      render :action=>"edit"
    end
  end

end
